// Initial File - Paul Jack

#ifndef __INCLUDED_USBMAIN_H__
#define __INCLUDED_USBMAIN_H__


#include <QObject>
#include <QEvent>
#include <QList>
#include <QFile>
#include "usbdevice.h"


// Events we want to pass along
enum
{
    EUsbAttachEvent = QEvent::User,
    EUsbDetachEvent
};


class Usb : public QObject
{
    Q_OBJECT

public:

    QList < UsbDevice *> getDeviceList();
    static Usb * getInstance(void);
    virtual DWORD init( void );
    bool isValidDevice( UsbDevice * device );

    

signals:
    // Signals from us to the outside world
    int deviceAttached(bool);
    int deviceListChanged(bool, QList<UsbDevice *>);


private:
    Usb();
    ~Usb();
    bool event( QEvent* e );
    int loadMatchTable( void );

    static Usb * mInstance;
    WDU_DRIVER_HANDLE mhDriver;
    QList<UsbDevice*> mDeviceList;

    QFile mDeviceFile;      // File with Vender/Product IDs to match
    WDU_MATCH_TABLE *mMatchTable;

};

#endif //__INCLUDED_USBMAIN_H__